package cn.biplam.front.component.view.systemManage.task.modelimport;

import cn.biplam.common.bean.md.MdTheme;
import cn.biplam.common.struc.MdStruc;
import cn.biplam.common.tools.DEBUG;
import cn.biplam.common.tools.TOOLS;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.common.wrapper.Result;
import cn.biplam.common.wrapper.UserInfo;
import cn.biplam.front.callback.CallBack;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.template.base.Text;

/**
 * 模型对象导入，处理字段绑定器
 * @author XiaoRuxing 2009-6-22下午03:59:24
 * @version 1.0
 */
public class ModelImportThemeCallBack implements CallBack{

	public HtmlWindow[] getGroup(Result data, String homeUrl, UserInfo mUser) throws ErrorMessage{
		HtmlWindow[] opetator=new HtmlWindow[1];
		opetator[0]= new Text("").get();
		try{
			
			/** 任务状态 */
			String modelType = data.getString(MdStruc.MdImpTaskStruc.MODEL_TYPE);
			String themeId = data.getString(MdStruc.MdImpTaskStruc.MODEL_THEME);
			
			MdTheme mto = MdTheme.getNewInstance(mUser,themeId,modelType);
			opetator[0]= new Text(mto.getName()).get(); 
			
			opetator[0].setLength(TOOLS.getTextLength(mto.getName()));
		}catch(ErrorMessage e){
			StringBuilder sb = new StringBuilder();
			e.getDescription(sb);
			if(sb.indexOf("java.lang.ClassNotFoundException")!=-1){
				DEBUG.println(sb.toString());
			}else{
				throw e;
			}
		}
		return opetator;
	}

}
